home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacApp Release 10 / MacApp Release 10 - HD Ready / Examples / A-Z / Q / QuickDraw3D / Simple QuickDraw 3D View / UQD3DApplication.cp < prev    next >
Encoding:
Text File  |  1996-04-03  |  4.1 KB  |  136 lines  |  [TEXT/MPS ]

  1. //----------------------------------------------------------------------------------------
  2. // USkeletonApplication.cp
  3. // Copyright © 1996 by Apple Computer, Inc. All rights reserved. 
  4. //----------------------------------------------------------------------------------------
  5.  
  6. #ifndef __UQD3DApplication__
  7. #include "UQD3DApplication.h"
  8. #endif
  9.  
  10. #ifndef __UCustomViewerDocument__
  11. #include "UCustomViewerDocument.h"
  12. #endif
  13.  
  14. #ifndef __UDefaultDocument__
  15. #include "UDefaultDocument.h"
  16. #endif
  17.  
  18. #ifndef __UQD3DViewer__
  19. #include "UQD3DViewer.h"
  20. #endif
  21.  
  22. #ifndef __UMENUMGR__
  23. #include "UMenuMgr.h"
  24. #endif
  25.  
  26. //----------------------------------------------------------------------------------------
  27. // Constants:
  28.  
  29. const OSType kSignature            = 'SS13';            // Application signature
  30. const OSType kFileType            = 'SF13';            // File Type
  31. CommandNumber cNewCustom        =  1717;            // New CustomViewer Command
  32.  
  33. //========================================================================================
  34. // CLASS TQD3DApplication
  35. //========================================================================================
  36. #undef Inherited
  37. #define Inherited TApplication
  38.  
  39. #pragma segment AInit
  40. MA_DEFINE_CLASS_M1(TQD3DApplication, Inherited);
  41.  
  42. //----------------------------------------------------------------------------------------
  43. // TQD3DApplication constructor
  44. //----------------------------------------------------------------------------------------
  45. #pragma segment AOpen
  46.  
  47. TQD3DApplication::TQD3DApplication()
  48. {
  49.     // Initialize fields to safe values here
  50. }
  51.  
  52. //----------------------------------------------------------------------------------------
  53. // TQD3DApplication destructor
  54. //----------------------------------------------------------------------------------------
  55. #pragma segment MADestructorRes
  56.  
  57. TQD3DApplication::~TQD3DApplication()
  58. {
  59. }
  60.  
  61. //----------------------------------------------------------------------------------------
  62. // TQD3DApplication::IQD3DApplication: 
  63. //----------------------------------------------------------------------------------------
  64. #pragma segment AInit
  65.  
  66. void TQD3DApplication::IQD3DApplication()
  67. {
  68.     this->IApplication(kFileType,kSignature);
  69. } // TQD3DApplication::IQD3DApplication 
  70.  
  71. //----------------------------------------------------------------------------------------
  72. // TQD3DApplication::DoMakeDocument:
  73. //----------------------------------------------------------------------------------------
  74. #pragma segment AOpen
  75.             
  76. TDocument* TQD3DApplication::DoMakeDocument(CommandNumber  itsCommandNumber,
  77.                                                         TFile* itsFile) // Override 
  78. {
  79.     switch (itsCommandNumber)
  80.         {
  81.             case 1717:
  82.                 TCustomViewerDocument* aCustomDocDocument = new TCustomViewerDocument;
  83.                 aCustomDocDocument->ICustomViewerDocument();
  84.                 return aCustomDocDocument;
  85.             break;
  86.  
  87.             case cFinderNew:
  88.             case cNew:
  89.                 TDefaultDocument* aDocument = new TDefaultDocument;
  90.                 aDocument->IDefaultDocument();
  91.                 return aDocument;
  92.             break;
  93.             
  94.             default:
  95.                  return Inherited::DoMakeDocument(itsCommandNumber,itsFile);
  96.             break;
  97.         }
  98. } // TQD3DApplication::DoMakeDocument 
  99.  
  100. //----------------------------------------------------------------------------------------
  101. // TQD3DApplication::DoSetupMenus:
  102. //----------------------------------------------------------------------------------------
  103. #pragma segment MAApplicationRes
  104.         
  105. void TQD3DApplication::DoSetupMenus() // Override 
  106. {
  107.     Inherited::DoSetupMenus();
  108.  
  109.     Boolean lowSpace = MemSpaceIsLow();
  110.     Enable(cNewCustom, !lowSpace);
  111. } // TQD3DApplication::DoSetupMenus 
  112.  
  113. //----------------------------------------------------------------------------------------
  114. // TQD3DApplication::DoMenuCommand:
  115. //----------------------------------------------------------------------------------------
  116. #pragma segment MASelCommand
  117.         
  118. void TQD3DApplication::DoMenuCommand(CommandNumber aCommandNumber)
  119. {
  120.     switch (aCommandNumber)
  121.         {
  122.             case 1717:
  123.                 this->DoNew(cNewCustom);    
  124.             break;
  125.                 
  126.             default:
  127.             Inherited::DoMenuCommand(aCommandNumber);
  128.             break;
  129.         }
  130. } // TQD3DApplication::DoSetupMenus 
  131.  
  132. //----------------------------------------------------------------------------------------
  133. // End of UQD3DApplication.cp
  134.  
  135. #pragma segment Inline
  136.